<!DOCTYPE html>
<html lang="en">

<head>
    <!-- <meta charset="UTF-8"> -->
    <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge"> -->
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
    <title>立方体</title>
    <style>
        /* * {
            padding: 0;
            margin: 0;
        } */
        
        body {
            perspective: 800px;
        }
        
        .cube {
            width: 200px;
            height: 200px;
            /* background-color: #bfa; */
            margin: 200px auto;
            /* position: relative; */
            animation: random_rotate 10s infinite;
            /* 指定变换类型 */
            transform-style: preserve-3d;
            /* transform: rotateY(45deg) scaleZ(2); */
        }
        
        @keyframes random_rotate {
            from {
                transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
            }
            to {
                transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
            }
        }
        
        .cube>div {
            width: 200px;
            height: 200px;
            opacity: 0.8;
            position: absolute;
            display: block;
        }
        /* .cube:hover {
            transform: scale(3);
        } */
        
        img {
            vertical-align: top;
        }
        /* left */
        
        .box1 {
            transform: rotateY(-90deg) translateZ(100px);
            background-color: orangered;
        }
        /* right */
        
        .box2 {
            transform: rotateY(90deg) translateZ(100px);
            background-color: pink;
        }
        /* forward */
        
        .box3 {
            transform: rotateY(0deg) translateZ(100px);
            background-color: blueviolet;
        }
        /* back */
        
        .box4 {
            transform: rotateX(180deg) translateZ(100px);
            background-color: cyan;
        }
        /* top */
        
        .box5 {
            transform: rotateX(90deg) translateZ(100px);
            background-color: lawngreen;
        }
        /* bottom */
        
        .box6 {
            transform: rotateX(-90deg) translateZ(100px);
            background-color: yellow;
        }
    </style>
</head>

<body>
    <div class="cube">
        <div class="box1">
            <img src="../images/cube/blue.png" alt="">
        </div>
        <div class="box2">
            <img src="../images/cube/green.png" alt="">
        </div>
        <div class="box3">
            <img src="../images/cube/orange.png" alt="">
        </div>
        <div class="box4">
            <img src="../images/cube/pink.png" alt="">
        </div>
        <div class="box5">
            <img src="../images/cube/red.png" alt="">
        </div>
        <div class="box6">
            <img src="../images/cube/yellow.png" alt="">
        </div>
    </div>
</body>

</html>